package cn.glutnn.dao;

import java.util.List;

import cn.glutnn.entity.Notice;
import cn.glutnn.entity.Room;
import cn.glutnn.util.JdbcUtils;

public class RoomDao {

	/**
	 * 影厅查询
	 */
	public List<Room> find(String name) {
		String sql = "select * from t_room where 1";
		if (name != null) {
			sql += " and name='" + name + "'";
		}
	
		List<Room> list = JdbcUtils.query(sql, Room.class);
		return list;
	}

	public boolean save(Room room) {
		return JdbcUtils.save(room);
	}
	
	/**
	 * 删除逻辑
	 */
	public boolean delete(Integer id) {
		return JdbcUtils.delete(id, Room.class);
	}

	/**
	 * 查找单个影厅对象
	 */
	public Room findOne(String name) {
		Room room = null;
		List<Room> list = this.find(name);
		if (list.size() == 1) {
			room = list.get(0);
		}
		// 2-2、获取影厅
		return room;
	}
	
	/**
	 * 更新
	 */
	public boolean update(Room room) {
		// 实现更新逻辑
		return JdbcUtils.update(room);
	}

}
